{% extends "./inc_base.html" %}
{% block content %}
{%set cate = category.id|get_cate()%}
<!--
PAGE HEADER

CLASSES:
.page-header-xs	= 20px margins
.page-header-md	= 50px margins
.page-header-lg	= 80px margins
.page-header-xlg= 130px margins
.dark			= dark page header

.shadow-before-1 	= shadow 1 header top
.shadow-after-1 	= shadow 1 header bottom
.shadow-before-2 	= shadow 2 header top
.shadow-after-2 	= shadow 2 header bottom
.shadow-before-3 	= shadow 3 header top
.shadow-after-3 	= shadow 3 header bottom
-->
<section class="page-header page-header-xs " >
    <div class="container">
        <!-- breadcrumbs -->
        <ol class="breadcrumb breadcrumb-inverse">
            <li><a href="/">首页</a></li>
            {%for val in breadcrumb %}
            {% if val.id == category.id %}
            <li class="active">{{val.title}}</li>
            {% else %}
            <li><a href="{{val.url}}">{{val.title}}</a></li>

            {% endif %}
            {% endfor %}
        </ol><!-- /breadcrumbs -->
        <!-- page tabs -->
    </div>
</section>
<!-- /PAGE HEADER -->
<!-- -->
<section>
    <div class="container">
        <!--分类信息-->
        {% include "./inc_sort.html" %}
        <!--/分类信息-->
        <div class="row">
            <!-- RIGHT -->
            <div class="col-md-9 col-sm-9">
                <div class="panel panel-default">
                    <div class="panel-body padding-10">
                        <div class="text-left">
                            <ul class="nav nav-pills mix-filter">

                                <li class="filter {%if group_id==0%}active{%endif%}"><a href="{{cate.url}}">全部</a></li>
                                {% groups data="groups",cid=category.id%}
                                {%for v in groups%}
                                <li class="filter {%if group_id==v.id%}active{%endif%}"><a href="{{cate.url}}-{{order}}-{{v.id}}{%if sort%}-{{sortid}}{%endif%}{%if sorturl %}-{%endif%}{{sorturl}}">{{v.name}}</a></li>
                                {%endfor%}
                            </ul>
                            {%if category.id|priv(controller.user.roleid,'add',0,false)%}
                            <!--投稿按钮-->
                            <div class="btn-group btn-group-xs pull-right">
                                <a {%if model|length> 1 %} data-toggle="dropdown" {% endif %} class="btn btn-primary btn-sm document_add
                                    dropdown-toggle {% if allow == 0 %}disabled{% endif %}" {%if model|length
                                    == 1 %} href="/center/publish/add/?model_id={{modellist[0].id}}&pid=0&cate_id={{cate.id}}&group_id={{group_id}}&sortid={{sortid}}"{%endif%}
                                    ><span class="fa fa-pencil-square-o"></span> 投稿 {%if model|length > 1 %}<span class="caret"></span>{% endif %}</a>
                                {%if model|length > 1 %}
                                <ul class="dropdown-menu">

                                    {% for val in modellist%}
                                    <li> <a href="/center/publish/add/?model_id={{val.id}}&pid=0&cate_id={{cate.id}}&group_id={{group_id}}&sortid={{sortid}}"
                                            class="text-info">添加{{val.title}}</a></li>
                                    {% endfor %}

                                    <!--<li class="divider"></li>-->
                                    <!--<li><a href="#">添加内容</a></li>-->
                                </ul>
                                {% endif %}
                            </div>
                            <!--//投稿按钮-->
                            {%endif%}
                            <div class="btn-group btn-group-xs pull-right">
                                <a class="btn btn-default height-auto {%if order<2%}active{%endif%}" href="{{cate.url}}-{%if order<2%}{{1-order}}{%else%}0{%endif%}{%if group_id or sort%}-{{group_id}}{%endif%}{%if sort%}-{{sortid}}{%endif%}{%if sorturl %}-{%endif%}{{sorturl}}" >按时间 <span class="glyphicon {%if order ==0%}glyphicon-arrow-down{%elif order==1%}glyphicon-arrow-up{%else%}glyphicon-arrow-down{%endif%}"></span> </a>
                                <a class="btn btn-default height-auto {%if order>=2%}active{%endif%}" href="{{cate.url}}-{%if order>=2%}{%if order ==2%}3{%else%}2{%endif%}{%else%}2{%endif%}{%if group_id or sort%}-{{group_id}}{%endif%}{%if sort%}-{{sortid}}{%endif%}{%if sorturl %}-{%endif%}{{sorturl}}" style="height: auto">按人气<span class="glyphicon  {%if order ==2%}glyphicon-arrow-down{%elif order==3%}glyphicon-arrow-up{%else%}glyphicon-arrow-down{%endif%}"></span></a>
                            </div>
                            <div class="divider divider-circle divider-center margin-top-0"><!-- divider -->
                                <a href="{{cate.url}}-{{order}}{%if group_id or sort%}-{{group_id}}{%endif%}{%if sort%}-{{sortid}}{%endif%}{%if sorturl %}-{%endif%}?rss=1" target="_blank"><i class="fa fa-rss"></i></a>
                            </div>
                        </div>
                    </div>
                </div>


                {% for val in list %}
                <!-- POST ITEM -->
                <div class="panel panel-default margin-bottom-10">
                    <div class="panel-body padding-10">
                        <div class="blog-post-item padding-bottom-0 margin-bottom-0 clearfix">

                            <!-- IMAGE -->

                            <figure class="download-item-image margin-bottom-0">
                                <img class="thumbnail margin-bottom-0" src="{{val.cover_id|get_pic('m=1,w=50,h=50')}}" width="50" height="50" alt="">
                            </figure>

                            <div class="download-item-content">
                                <h2 class="size-18 margin-bottom-6"><a href="{{val.name|get_url(val.id)}}">{{val.title}}</a></h2>
                                <ul class="blog-post-info list-inline padding-bottom-0 margin-bottom-6" >
                                    <li>
                                        <a href="#">
                                            <i class="fa fa-clock-o"></i>
                                            <span class="font-lato">{{val.create_time|moment('YYYY-MM-DD HH:mm')}}</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="#">
                                            <i class="fa fa-comment-o"></i>
                                            <span class="font-lato">{{val.view}} Comments</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="#">
                                            <i class="fa fa-user"></i>
                                            <span class="font-lato">{{val.uid|get_nickname}}</span>
                                        </a>
                                    </li>
                                </ul>

                                <p>{{val.description|truncate(90, true, "...")}}</p>
                                <a href="{{val.id|getmodelfield(val.model_id,'file_id')|get_file('savename',true)}}" class="btn btn-reveal btn-default donwload-btn">
                                    <i class="glyphicon glyphicon-download-alt"></i>
                                    <span>立即下载</span>
                                </a>
                            </div>

                        </div>
                    </div>
                </div>

                <!-- /POST ITEM -->
                {%endfor%}

           {%if pagination%}
                <div class="panel panel-default margin-top-20" >
                    <div class="panel-heading text-right">
                        <!-- PAGINATION -->
                        <!-- Pagination Default -->
                        {{pagination | safe}}
                        <!-- /Pagination Default -->
                        <!-- /PAGINATION -->
                    </div>
                </div>
           {%endif%}

            </div>
            <!-- LEFT -->
            <div class="col-md-3 col-sm-3">
                <!-- INLINE SEARCH -->
                <div class="inline-search clearfix margin-bottom-20">
                    <form action="/search" method="get" class="widget_search" target="_blank">
                        <input type="search" placeholder="请输入关键词..." id="q" name="q" class="serch-input">
                        <button type="submit">
                            <i class="fa fa-search"></i>
                        </button>
                    </form>
                </div>
                <!-- /INLINE SEARCH -->

                <!-- side navigation -->
                {%if category.pid !=0%}
                {%column data="column",pid=category.pid,isnum="1"%}
                {%else%}
                {%column data="column",cid=category.id,isnum="1"%}
                {%endif%}
                {%if column%}
                <div class="panel panel-default side-nav">
                    <div class="panel-heading">
                        <h2 class="panel-title">{{breadcrumb[0].title}}分类</h2>
                    </div>
                    <div class="panel-body" style="padding: 10px 0 0 10px">
                        <ul class="list-group list-group-bordered  uppercase">
                            {%for val in column%}
                            <li class="list-group-item "><a href="{{val.url}}" ><span class="badge badge-light pull-right">{{val.doc_num}}</span>
                                {{val.name}}</a></li>
                            {%endfor%}
                        </ul>
                    </div>
                </div>
                {%endif%}

                <div class="panel panel-default tabs">
                    <div class="panel-heading">
                        <ul class="nav nav-tabs nav-justified">
                            <li class="active">
                                <a href="#tab_1" data-toggle="tab">
                                    最热
                                </a>
                            </li>
                            <li>
                                <a href="#tab_2" data-toggle="tab">
                                    最新
                                </a>
                            </li>
                        </ul>
                    </div>
                    <div class="panel-body tab-content">
                        <!-- POPULAR -->
                        <div id="tab_1" class="tab-pane active">
                            <!--topic tags test-->
                            {% topic data = "hotlist",limit= "5",cid=category.id,type="hot"%}
                            <!--返回数据赋值给变量data,遍历data-->
                            {%for v in hotlist%}
                            <div class="row tab-post"><!-- post -->

                                <div class="col-md-3 col-sm-3 col-xs-3">
                                    <a href="{{v.name|get_url(v.id)}}">
                                        <img src="{{v.cover_id|get_pic('m=1,w=50,h=50')}}" width="50" alt=""/>
                                    </a>
                                </div>

                                <div class="col-md-9 col-sm-9 col-xs-9">
                                    <a href="{{v.name|get_url(v.id)}}" class="tab-post-link">{{v.title}}</a>
                                    <small><a href="{{v.name|get_url(v.id)}}"
                                              class="btn btn-3d btn-xs btn-reveal btn-white">
                                        <i class="fa fa-download"></i>
                                        <span>立即下载</span>
                                    </a></small>
                                </div>
                            </div><!-- /post -->
                            {%endfor%}

                        </div>
                        <!-- /POPULAR -->


                        <!-- RECENT -->
                        <div id="tab_2" class="tab-pane">

                            {% topic data = "newlist",limit= "5",cid=category.id%}
                            {%for v in newlist%}
                            <div class="row tab-post"><!-- post -->

                                <div class="col-md-3 col-sm-3 col-xs-3">
                                    <a href="{{v.name|get_url(v.id)}}">
                                        <img src="{{v.cover_id|get_pic('m=1,w=50,h=50')}}" width="50" alt=""/>
                                    </a>
                                </div>

                                <div class="col-md-9 col-sm-9 col-xs-9">
                                    <a href="{{v.name|get_url(v.id)}}" class="tab-post-link">{{v.title}}</a>
                                    <small><a href="{{val.name|get_url(val.id)}}"
                                              class="btn btn-3d btn-xs btn-reveal btn-white">
                                        <i class="fa fa-download"></i>
                                        <span>立即下载</span>
                                    </a></small>
                                </div>
                            </div><!-- /post -->
                            {%endfor%}
                            <!-- /post -->
                        </div>
                        <!-- /RECENT -->
                    </div>
                </div>


                <!-- TAGS -->
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <a class="btn btn-danger btn-xs pull-right">更多</a>
                        <h2 class="panel-title">话题</h2>
                    </div>
                    <div class="panel-body padding-10">
                        {% keywords data ="kws",type="hot"%}
                        {%for key in kws%}
                        <a class="tag" href="{{key.url}}">
                            <span class="txt">{{key.keyname}}</span>
                            <span class="num">{{key.videonum}}</span>
                        </a>
                        {%endfor%}
                    </div>
                    <div class="panel-footer panel-footer-transparent clearfix">
                        <a href="#" class="social-icon social-icon-border social-facebook pull-left" data-toggle="tooltip" data-placement="top" title="Facebook">
                            <i class="icon-facebook"></i>
                            <i class="icon-facebook"></i>
                        </a>

                        <a href="#" class="social-icon social-icon-border social-twitter pull-left" data-toggle="tooltip" data-placement="top" title="Twitter">
                            <i class="icon-twitter"></i>
                            <i class="icon-twitter"></i>
                        </a>

                        <a href="#" class="social-icon social-icon-border social-gplus pull-left" data-toggle="tooltip" data-placement="top" title="Google plus">
                            <i class="icon-gplus"></i>
                            <i class="icon-gplus"></i>
                        </a>

                        <a href="#" class="social-icon social-icon-border social-linkedin pull-left" data-toggle="tooltip" data-placement="top" title="Linkedin">
                            <i class="icon-linkedin"></i>
                            <i class="icon-linkedin"></i>
                        </a>

                        <a href="#" class="social-icon social-icon-border social-rss pull-left" data-toggle="tooltip" data-placement="top" title="Rss">
                            <i class="icon-rss"></i>
                            <i class="icon-rss"></i>
                        </a>
                    </div>
                </div>

            </div>


        </div>

    </div>
</section>
<!-- / -->
{% endblock %}